package org.midi.module.common;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

public class Word {

	private String prefix;

	private String part1;

	private String part2;

	public Word(String line) {
		prefix = line.substring(0, 1);
		int pos = line.indexOf('-');
		part1 = line.substring(0, pos - 1);
		part2 = line.substring(pos + 2, line.length());
		print();
	}

	public Word(DataInputStream dis) throws IOException {
		part1 = dis.readUTF();
		part2 = dis.readUTF();
	}

	public String getPart1() {
		return part1;
	}

	public void setPart1(String part1) {
		this.part1 = part1;
	}

	public String getPart2() {
		return part2;
	}

	public void setPart2(String part2) {
		this.part2 = part2;
	}

	public String getPrefix() {
		return prefix;
	}

	public void write(DataOutputStream dos) throws IOException {
		dos.writeUTF(this.part1);
		dos.writeUTF(this.part2);
	}

	public void print() {
		System.out.println(part1 + " " + part2);

	}
}
